import { _decorator, Animation, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
/**
 * 刀光
 */
@ccclass('Blade')
export class Blade extends Component {

    private _animation: Animation;

    protected onLoad(): void {
        this._animation = this.node.getComponent(Animation);
    }
    protected onEnable(): void {
        this._animation.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
    }
    protected onDisable(): void {
        this._animation.stop();
        this._animation.off(Animation.EventType.FINISHED, this.onAnimationFinished, this);
    }

    start() {

    }

    update(deltaTime: number) {

    }

    private onAnimationFinished() {
        this.node.active = false;
    }

    show() {
        this._animation.play('NormalAttack');
    }
}


